#include "Actions/ActionRotateObject.h"

using namespace Ogre;
ActionRotateObject::ActionRotateObject(Ogre::SceneNode *node){

	mCurrentObject = node;
	mCurrentObject->showBoundingBox(true);
    mRotate = 0.13;
	axis=0;
}

ActionRotateObject::~ActionRotateObject(){}

void ActionRotateObject::mouseMoved(const OIS::MouseEvent &evt){

	if(axis==0 || axis==1)
		mCurrentObject->yaw(Degree(mRotate * evt.state.X.rel), Node::TS_WORLD);
	if(axis==0 || axis==2)
		mCurrentObject->pitch(Degree(-mRotate * evt.state.Y.rel), Node::TS_LOCAL);
}

void ActionRotateObject::mousePressed(const OIS::MouseEvent &evt){

	mCurrentObject->showBoundingBox(false);
	//mCurrentObject->scale(0.1,0.1,0.1);
}

void ActionRotateObject::selectAxis(int ax){
	
	axis=ax;
}